Skip to content

fix: panic on launch from tokio::spawn in window close handler#214

Closed
MeckMan2025 wants to merge 2 commits intojamiepine:mainfrom
MeckMan2025:fix/tauri-window-close-panic
Closed

fix: panic on launch from tokio::spawn in window close handler#214
MeckMan2025 wants to merge 2 commits intojamiepine:mainfrom
MeckMan2025:fix/tauri-window-close-panic

Conversation

@MeckMan2025
Copy link

@MeckMan2025 MeckMan2025 commented Feb 28, 2026

Summary

  • The on_window_event close handler used tokio::spawn directly, which panics with "there is no reactor running, must be called from the context of a Tokio 1.x runtime" because the handler runs outside the Tokio runtime context.
  • Replaced with tauri::async_runtime::spawn which correctly routes through Tauri's managed async runtime.

Details

One-line change in tauri/src-tauri/src/main.rs line 678:

- tokio::spawn(async move {
+ tauri::async_runtime::spawn(async move {

This crash occurs on every launch — the app compiles and starts, then immediately panics before the window renders.

Test plan

  • App launches without panic
  • Window close still works correctly (frontend receives window-close-requested event, responds, and window closes)
  • Tested on macOS 26.3 (Apple Silicon)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chore
    • Removed an outdated internal comment; no functional or user-facing changes.

The window close handler in on_window_event used tokio::spawn directly,
which panics because there is no Tokio reactor running in that context.
Replaced with tauri::async_runtime::spawn which correctly routes through
Tauri's managed async runtime.

Fixes: "there is no reactor running, must be called from the context of
a Tokio 1.x runtime" panic on app launch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4e5fc699-4c6e-4b93-8954-e58416477a66

📥 Commits

Reviewing files that changed from the base of the PR and between 50057e0 and 1058925.

📒 Files selected for processing (1)
  • tauri/src-tauri/src/main.rs
💤 Files with no reviewable changes (1)
  • tauri/src-tauri/src/main.rs

📝 Walkthrough

Walkthrough

Removed a comment in tauri/src-tauri/src/main.rs that referenced using tauri::async_runtime::spawn instead of tokio::spawn; there are no functional changes to code, control flow, or logic.

Changes

Cohort / File(s) Summary
Comment cleanup
tauri/src-tauri/src/main.rs
Deleted a comment documenting the use of tauri::async_runtime::spawn vs tokio::spawn. No code or behavior changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nibble lines and tidy text,
A tiny note I clipped, unvexed,
Code unchanged, the meadow still,
Just fewer words — a cleaner hill. 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes fixing a panic issue, but the actual change in the provided raw_summary is only removing a comment with no functional changes. The title claims a functional fix (tokio::spawn to tauri::async_runtime::spawn), but the raw_summary shows only a comment removal. Verify the actual changes match the title or update the title to reflect what was actually changed.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

jamiepine added a commit that referenced this pull request Mar 13, 2026
Cherry-picked and adapted from PR #89 and #214:

- Linux audio capture via PulseAudio/PipeWire monitor sources (cpal)
- AMD ROCm GPU support: HSA_OVERRIDE_GFX_VERSION env var, ROCm detection
- Whisper Turbo model (openai/whisper-large-v3-turbo) in all endpoints
- Cleaner Whisper language handling via generate_kwargs
- tauri::async_runtime::spawn fix to prevent panic on app shutdown
- Enable Linux (ubuntu-22.04) in release CI matrix
@jamiepine jamiepine closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants